<?php
header("content-type:text/html;charset=utf8");
$pdo = new PDO("mysql:host=127.0.0.1;dbname=11-9;charset=utf8",'root','root');
$redis =new Redis();
$redis->connect("127.0.0.1",'6379');
$id = $_GET['id'];
$sql = "select * from exe where id = $id";
$data = $pdo->query($sql)->fetch();
if ($redis->get("visit".$id))
{
    $redis->incr("visit".$id);
    $visit = $redis->get("visit".$id);
}else{
    $redis->set("visit".$id,1);
    $visit = $redis->get("visit".$id);
}
?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<center>
    这是你弟<?php echo $visit;?>次访问次商品
    <table>
        <tr>
            <td>商品名</td>
            <td>价格</td>
            <td>数量</td>
        </tr>

        <tr>
            <td><?php echo $data['name']?></td>
            <td><?php echo $data['money']?></td>
            <td><?php echo $data['age']?></td>
        </tr>

    </table>
</center>
</body>
</html>
